Introduction to non-parametric tests
When and why we might use non-parametric alternatives to ANOVA
How rank-based tests work
The Kruskal–Wallis test
The logic of the test
Calculating and interpreting the test statistic
Follow-up comparisons
Planned comparisons and post-hoc tests
Correcting for multiple comparisons
Interpreting and consolidating results
Interpreting Kruskal–Wallis and follow-up comparisons
Comparing Kruskal–Wallis with parametric ANOVA
Single-factor between-participants ANOVA assumes:
Independence of observations
Normality: Scores are approximately normally distributed within each group
Homogeneity of variance: Population variances are equal across groups
What can we do when these assumptions are not well met?
Key points:
| Observation | Score | Rank |
|---|---|---|
| A | 23 | 3 |
| B | 31 | 4 |
| C | 2 | 1 |
| D | 4 | 2 |
A simple example ...
A psychologist investigates whether misinformation warnings improve people's ability to distinguish between true and false information on social media
The no-warning and generic-warning groups both exhibit positively skewed distributions
Both groups contain an unusually high score relative to their remaining observations
With small samples, extreme observations can have a substantial influence on group means and variance estimates
A rank-based alternative to ANOVA may therefore be worth considering
If the groups do not differ, we would expect them to have similar average ranks
If one condition tends to produce higher scores, that condition should also receive higher ranks
So the Kruskal–Wallis test asks:
Are the group rank totals more different than we would expect by chance?
| Score | Group | Rank |
|---|---|---|
| 20 | A₁ | 1 |
| 25 | A₁ | 2 |
| 30 | A₁ | 3 |
| 35 | A₁ | 4 |
| 42 | A₂ | 5 |
| 47 | A₂ | 6 |
| 52 | A₂ | 7 |
| 57 | A₂ | 8 |
| 72 | A₃ | 9 |
| 77 | A₃ | 10 |
| 82 | A₃ | 11 |
| 85 | A₁ | 12 |
| 87 | A₃ | 13 |
| 92 | A₂ | 14 |
| 97 | A₃ | 15 |
| Group | Scores | Ranks | Sum of ranks | Mean rank |
|---|---|---|---|---|
| A₁ | 20, 25, 30, 35, 85 | 1, 2, 3, 4, 12 | 22 | 4.40 |
| A₂ | 42, 47, 52, 57, 92 | 5, 6, 7, 8, 14 | 40 | 8.00 |
| A₃ | 72, 77, 82, 87, 97 | 9, 10, 11, 13, 15 | 58 | 11.60 |
\(R_j\)
The sum of the ranks from 1 to \(N\) is given by:
\[ \boxed{\sum_{i=1}^{N}i=\frac{N(N+1)}{2}} \]
Where \(N\) is the total number of observations
\[ \frac{15(15+1)}{2}=\frac{15(16)}{2}=120 \]
We can then check this against the sum of the ranks across our three groups:
\[ 22+40+58=120 \]
Square each group's rank total, divide by its sample size, and sum across groups.
Scales the sum of the squared rank totals, accounting for the total sample size.
| Chi-squared critical values | |||
|---|---|---|---|
| df | α = .10 | α = .05 | α = .01 |
| 1 | 2.706 | 3.841 | 6.635 |
| 2 | 4.605 | 5.991 | 9.210 |
| 3 | 6.251 | 7.815 | 11.345 |
| 4 | 7.779 | 9.488 | 13.277 |
| 5 | 9.236 | 11.070 | 15.086 |
Upper-tail critical values. Highlighted: df = 2, α = .05.
| Effect size | Interpretation |
|---|---|
| .01 to less than .06 | Small |
| .06 to less than .14 | Moderate |
| .14 or greater | Large |
Our result of \(\eta_H^2=.37\) would therefore be classified as a large effect
The Kruskal–Wallis test is an omnibus test: it evaluates whether there are differences among the group distributions
However, a statistically significant result does not tell us which groups differ
As with parametric ANOVA, we can investigate specific group differences using planned comparisons or post-hoc tests
The Wilcoxon rank-sum test (also known as the Mann–Whitney U test) is a non-parametric alternative to the independent-samples \(t\)-test
Compares two independent groups
Combines the observations from both groups and ranks them from smallest to largest
Examines whether the ranks tend to be higher in one group than the other
Can be used to test specific hypotheses established before examining the data
Example: We might predict that participants receiving a specific warning (A₃) will achieve higher accuracy scores than those receiving no warning (A₁)
When we want to investigate differences between multiple pairs of groups, we can use Dunn's test
A rank-based procedure commonly used for pairwise comparisons following Kruskal–Wallis
Compares the mean ranks of two groups
Uses the ranks calculated across all groups, rather than ranking each pair separately
Produces a test statistic and p-value for each comparison
For our example, we could compare (see right):
Conducting multiple statistical tests increases the probability of making at least one Type I error
As with parametric ANOVA, we can control the familywise error rate by adjusting for multiple comparisons
Two common methods are:
Bonferroni correction: Controls the familywise error rate by dividing the significance level by the number of comparisons (or equivalently adjusting p-values)
Holm correction: Applies a sequential adjustment to p-values, generally providing greater statistical power than Bonferroni while still controlling the familywise error rate
For our example, we will use Holm-adjusted p-values
| Comparison | Adjusted p | Significant? |
|---|---|---|
| A₁ vs A₂ | .406 | No |
| A₁ vs A₃ | .033 | Yes |
| A₂ vs A₃ | .406 | No |
A significant Kruskal–Wallis test indicated differences among the warning conditions:
\[ H(2)=6.48,\quad p=.039 \]
We conducted pairwise comparisons using Dunn's test with Holm correction
| Feature | Between-Participants ANOVA | Kruskal–Wallis |
|---|---|---|
| Design | Independent groups | Independent groups |
| Data analysed | Original scores | Ranks of scores |
| Comparison | Group means | Group rank distributions |
| Normality | Assumes normally distributed scores within groups | Does not require normality |
| Homogeneity of variance | Assumes equal population variances | Does not require equal variances, although differences in distributional shape or spread affect interpretation |
| Test statistic | F | H |
| Reference distribution | F distribution | Chi-squared distribution (approximate) |
| Planned comparisons | Planned contrasts or t-tests | Wilcoxon rank-sum tests |
| Post-hoc comparisons | Tukey's HSD | Dunn's test |
The Kruskal–Wallis test is a non-parametric alternative to single-factor between-participants ANOVA
Rather than comparing group means, it uses ranks to evaluate differences between independent groups
The \(H\) statistic measures differences in the groups' rank distributions and is evaluated using a chi-squared reference distribution
Planned comparisons and post-hoc tests allow us to investigate specific group differences